import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";

type Result = {
  status: number;
  msg: string;
  success: boolean;
};

type ResultOrganization = {
  success: boolean;
  data?: {
    list: Array<any>;
    totalCount: number;
  };
};

/** 获取机构设置列表 */
export const OrganizationGetPage = (params?: object) => {
  return http.request<ResultOrganization>(
    "get",
    baseUrlApi("/Organization/GetPage"),
    {
      params
    }
  );
};

//保存机构
export const OrganizationSave = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("/Organization/Save"), {
    data
  });
};

//保存机构
export const OrganizationUpdate = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("/Organization/Update"), {
    data
  });
};

//删除机构
export const OrganizationDelete = (data?: object) => {
  console.log(data);
  return http.request<Result>("post", baseUrlApi("/Organization/Delete"), {
    params: {
      organizationId: data
    }
  });
};
